package cn.wit.front.controller;

import cn.wit.front.condition.SearchTechDirectionCondition;
import cn.wit.front.service.TechDirectionService;
import cn.wit.utils.pojo.TechDirection;
import cn.wit.utils.response.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/tech/techDirection")
@CrossOrigin
@Api(tags = "技术方向")
public class TechDirectionController {
    private Logger logger = LoggerFactory.getLogger(TechDirectionController.class);

    @Autowired
    private TechDirectionService techDirectionService;

    @GetMapping("/selectAllTechDirection")
    @ApiOperation(value = "查询所有技术方向")
    public Result selectAllTechDirection(){
        return this.techDirectionService.selectAllTechDirection();
    }

    @GetMapping("/searchTechDirection/{num}/{size}")
    @ApiOperation(value = "条件搜索技术方向")
    public Result searchTechDirection(@PathVariable("num") int num,
                                      @PathVariable("size") int size, SearchTechDirectionCondition condition){
        IPage<TechDirection> page=new Page<>(num,size);
            return this.techDirectionService.searchPage(page, condition);
    }
}
